This invention relates to computers which include a host operating system, and a foreign operating system which runs under the host operating system; and more particularly, it relates to methods of sharing an I/O device between such host operating system and foreign operating system.
In the prior art, a digital computer typically comprises an instruction processor, a digital memory which is coupled to the instruction processor, a host operating system which is stored in the memory, and multiple native application programs which are also stored in the memory and run under the control of the host operating system. This instruction processor executes certain types of object code instructions directly without modification, and the host operating system as well as each native application program is a compilation of those object code instructions.
Also, one of the native application programs can be an emulator program which implements another set of instructions which are foreign to the instruction processor. This is achieved, in the emulator, by providing a respective sequence of object code instructions for each foreign instruction that is to be implemented. Then, for each particular foreign instruction that is to be executed, the corresponding sequence of object code instructions is executed.
When the emulator program is included in the computer, then that emulator can be used to run another operating system and another set of application programs which are a compilation of the foreign instructions. In the prior art, one such computer which includes a native operating system, and emulator, a foreign operating system and foreign application programs is disclosed in U.S. Pat. No. 5,794,011 which is assigned to the assignee of the present application.
Now, from time to time, it is necessary to add/delete particular native application programs which run under the native operating system, and add/delete particular foreign application programs which run under the foreign operating system. To do that, one I/O device can be provided for exclusive use by the native operating system, and another I/O device can be provided for exclusive use by the foreign operating system. But then, the cost of the I/O device is duplicated.
Alternatively, a single I/O device can be provided in the computer which is shared by the native operating system and the foreign operating system. However, in the prior art, the single I/O device was required to be identified in a registry within the host operating system as an I/O device which was used exclusively by either the host operating system or the foreign operating system. Thus, the registry had to be changed whenever the use of the I/O device changed from one operating system to the other. But, the registry is read and acted upon by the host operating system only when the entire host operating system is initially loaded into the memory by an operator; and such loading of the host operating system is a time-consuming manual operation.
Accordingly, a primary object of the present invention is to provide a method of sharing an I/O device between the host operating system and the foreign operating system in which the above drawbacks are overcome.
With the present invention, a method is provided by which an I/O device is shared between a host operating system, and a foreign operating system that runs under the host operating system, in a single computer. To use this invention, the I/O device must be of a type which includes a port driver that receives device commands for reading addressable fields on a removable data storage media. Such an I/O device is shared, via the present invention, by storing a first identifier in a particular addressable field on the removable data storage media if that media is to be used as a source of data for the host operating system; and storing a second identifier in a particular addressable field on the removable data storage media if that media is to be used for a source of data for the foreign operating system. Also, a registry is included in the host operating system which indicates that the I/O device is to be used exclusively by the host operating system; but in addition, a different private registry is included in the foreign operating system which indicates how that operating system can address the I/O device. Due to these two registries, both operating systems will attempt to use the I/O device. Then, each time the host operating system starts to use the I/O device, it tries to find the first identifier on the storage media. If that first identifier is not found, the host operating system terminates its use of the I/O device. Similarly, each time the foreign operating system starts to use the I/O device, it tries to find the second identifier on the storage media, and it terminates its use if the second identifier is not found.